<?php

use yii\db\Migration;

class m180522_090753_create_customer_field_congfig_relation extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
        }
        $this->createTable('{{%customer_field_config_relation}}', [
            'id' => $this->primaryKey(),
            'customer_field_config_id' => $this->integer(11)->defaultValue(0)->notNull()->comment('配置项表id'),
            'site_id' => $this->integer(11)->defaultValue(0)->notNull()->notNull()->comment('分店id'),
            'module' => $this->string(20)->defaultValue('')->notNull()->comment('针对模块 （customer 会员 student 学员）'),
        ],$tableOptions);
    }

    public function safeDown()
    {
        $this->dropTable('{{%customer_field_config_relation}}');
    }
    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180522_090753_create_customer_field_congfig_relation cannot be reverted.\n";

        return false;
    }
    */
}
